package com.cyj.service.impl;

import com.cyj.dao.AnimeCommentDao;
import com.cyj.entity.AnimeComment;
import com.cyj.pojo.AnimeCommentVo;
import com.cyj.service.AnimeCommentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AnimeCommentServiceImpl implements AnimeCommentService {

    @Autowired
    private AnimeCommentDao animeCommentDao;

    @Override
    public AnimeComment selectAnimeComment(Map map) {
        return animeCommentDao.selectAnimeComment(map);
    }

    @Override
    public PageInfo<AnimeCommentVo> selectAnimeCommentListVo(Map map, int pn, int pageSize) {
        PageHelper.startPage(pn,pageSize);

        List<AnimeCommentVo> list = animeCommentDao.selectAnimeCommentListVo(map);

        PageInfo<AnimeCommentVo> pageInfo = new PageInfo<AnimeCommentVo>(list,5);
        return pageInfo;
    }

    @Override
    public Integer addAnimeComment(AnimeComment animeComment) {
        return animeCommentDao.addAnimeComment(animeComment);
    }

    @Override
    public Integer updateAnimeComment(AnimeComment animeComment) {
        return animeCommentDao.updateAnimeComment(animeComment);
    }

    @Override
    public Integer deleteAnimeComment(Integer commentId) {
        return animeCommentDao.deleteAnimeComment(commentId);
    }
}
